const config=require('../../config/config')
const jwt=require('jsonwebtoken')

const signtoke=async(userinfo)=>{
    return  jwt.sign({
   data: userinfo
}, config.secretString, { expiresIn: '1h' });
   
}

const vertoke=async(token)=>{
    return await jwt.verify(token, config.secretString, function(err, decoded) {
 if(err){
  return err.name
 }
 else{
    return decoded.data[0]
 }
});
}



module.exports={
    signtoke,
    vertoke
}